package com.baizhi.controller;

import com.baizhi.entity.Book;
import com.baizhi.entity.BookDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("book")
public class BookController {
    @RequestMapping("interceptor")
    public String testInterceptor(){
        System.out.println("控制器类中的拦截器方法被执行了");
        return "index";
    }
    @RequestMapping("deleteAll")
    public String deleteAll(BookDTO bookDTO){
        List<Integer> ids = bookDTO.getIds();
        for (Integer id : ids) {
            System.out.println(id);
        }
        return "index";
    }
    @RequestMapping("addAll")
    public String addAll(BookDTO bookDTO){
        List<Book> books = bookDTO.getBooks();
        for (Book book : books) {
            System.out.println(book);
        }
        return "index";
    }

}
